/**
 * 分类-风格分类 后端接口
 */

const router = require('express').Router()
const { json } = require('body-parser')
const db = require('../../../dbconfig')

router.post('/classstyle',(req,res) => {
    let sql = "" // sql语句
    if(req.query.value == 1){
        sql = "select id,name,englishname,img,style from artisticworks where style='新印象派'"
    }if(req.query.value == 2){
        sql = "select id,name,englishname,img,style from artisticworks where style='后印象派'"
    }if(req.query.value == 3){
        sql = "select id,name,englishname,img,style from artisticworks where style='巴洛克'"
    }if(req.query.value == 4){
        sql = "select id,name,englishname,img,style from artisticworks where style='文艺复兴'"
    }
    db.query(sql, (err, data) => {
        // console.log(data)
        res.send(JSON.stringify(data))
    })
})

module.exports = router